﻿using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Practices.ObjectBuilder;
using Microsoft.Practices.CompositeWeb;
using WCSFContrib.Extensions.CompositeWeb;
using Microsoft.Practices.CompositeWeb.Utility;
using Orders.Entities;

namespace CreateShared.Orders_Module.Views
{
    public class OrderDetailsPresenter : Presenter<IOrderDetailsView>
    {

        // NOTE: Uncomment the following code if you want ObjectBuilder to inject the module controller
        //       The code will not work in the Shell module, as a module controller is not created by default
        //
        private IOrders_ModuleController _controller;
        public OrderDetailsPresenter([CreateShared] IOrders_ModuleController controller)
        {
            _controller = controller;
            controller.OrderSelected += new EventHandler<DataEventArgs<string>>(_controller_OrderSelected);
        }

        void _controller_OrderSelected(object sender, DataEventArgs<string> e)
        {
            View.OrderRows = _controller.RetrieveOrderRows(e.Data);
        }

        public override void OnViewLoaded()
        {
            // TODO: Implement code that will be executed every time the view loads
        }

        public override void OnViewInitialized()
        {
            // TODO: Implement code that will be executed the first time the view loads
        }

        // TODO: Handle other view events and set state in the view
    }
}




